package game.screen;

import com.badlogic.gdx.graphics.g2d.BitmapFont;

import game.logic.GameControl;
import game.shared.Constants;
import game.shared.Resources;
import game.windows.Button;

public class ScreenGameLost extends AbsScreen{

	BitmapFont font;
	Button bt;
	public ScreenGameLost(GameControl _gameControl) {
		super(_gameControl);
		font = new BitmapFont();
		bt = new Button(Constants.FUNCTION_CODE_NEWGAME, 
				Resources.getTextureRegion(Resources.MENU_NEWGAME), Resources.getTextureRegion(Resources.MENU_NEWGAME_2));
		bt.setXY(100, 100);
	}
	
	@Override
	public void update() {
		bt.update();
		dispatch();
	}
	
	private void dispatch() {
		switch (Constants.get_RETURN_CODE()) {
		case Constants.FUNCTION_CODE_NEWGAME:
			gameControl.setScreen(Constants.SCREEN_PLAYING);
//			Constants.set_RETURN_CODE(Constants.FUNCTION_CODE_NONE);
			Constants.set_RETURN_VALUE(1); 
			Constants.set_RETURN_CODE(Constants.FUNCTION_CODE_NEWGAME);
			break;

		default:
			break;
		}
	}

	@Override
	public void render(float arg0) {
		sb.begin();
		font.draw(sb, "you lost", Constants.SCREEN_WIDTH / 2, Constants.SCREEN_HEIGHT / 2);
		bt.render(sb);
		sb.end();
	}
}
